<?php
header("content-type:text/html;charset=utf-8");
$str = "this is a test";
echo urlencode($str);
echo "<hr/>";
$str = "urlencode.php?username=2+3%4 imooc&king# or \ 1=1";
echo urlencode($str);
echo "<hr/>";
/*
	?		%3F
	=		%3D
	空格	+
	%		%25
	&		%26
	\		%5C
	+		%2B	
*/
$urlencodeStr =urlencode($str);
$strStr = urldecode($urlencodeStr);
echo $strStr;
echo "<hr/>";

if(!empty($_GET)){
	print_r($_GET);
}
echo "<a href='urlencode.php?username=imooc&king&age=2'>慕课网信息</a>";
$username = "imooc&king";
$queryStr = "username=".urlencode($username)."&age=2";
echo "<a href='urlencode.php?{$queryStr}'>test</a>";


//rawurlencode
//rawurldecode    空格		%20
echo "<hr/>";
echo urlencode("this is a test");
echo "<hr/>";
echo rawurlencode("this is a test");
echo "<hr/>";
echo rawurldecode("this%20is%20a%20test");
?>